---
category: Misc
created: '2020-05-02'
title: Check if the code is running in NodeJS
updated: '2021-10-13'
---

**JavaScript version**

```js isNode.js
const isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
```

**TypeScript version**

```ts isNode.ts
const isNode: boolean = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;
```
